package com.yanxi.controller;


import com.yanxi.pojo.JobOption;
import com.yanxi.pojo.Result;
import com.yanxi.service.ReportService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RequestMapping("/report")
@RestController
public class ReportController {
    public static final Logger log = LoggerFactory.getLogger(ReportController.class);

    @Autowired
    private ReportService reportService;
    @GetMapping("/empJobData")
    public Result getEmpJobData(){
        log.info("获取员工岗位数据");
        JobOption jobOption = reportService.getEmpJobData();
        return Result.success(jobOption);
    }

    @GetMapping("/empGenderData")
    public Result getEmpGenderData(){
        log.info("获取员工性别数据");
        List<Map<String, Object>> list = reportService.getEmpGenderData();
        return Result.success(list);
    }

    //班级人数统计
    @GetMapping("/studentCountData")
    public Result getStudentCountData(){
        log.info("获取班级人数统计");
        JobOption studentJobOption = reportService.getStudentCountData();
        return Result.success( studentJobOption);
    }

    //学历人数统计
    @GetMapping("/studentDegreeData")
    public Result getStudentDegreeData(){
        log.info("获取学历人数统计");
        List<Map<String, Object>> list = reportService.getStudentDegreeData();
        return Result.success( list);
    }

}
